//Name:
//Purpose:
//Author: wjy
//Date: 2022-01-25 11:09:52
//From:

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    float commission, value;
    while (1)
    {
        printf("Enter value of trade: ");
        scanf("%f", &value);
        if (value == 0)
        {
            break;
        }
        else
        {
            if (value < 2500.00f)
            {
                commission = 30.00f + 0.017f * value;
            }
            else if (value < 6250.00f)
            {
                commission = 56.00f + 0.0066f * value;
            }
            else if (value < 20000.00f)
            {
                commission = 76.00f + 0.034f * value;
            }
            else if (value < 50000.00f)
            {
                commission = 100.00f + 0.0022f * value;
            }
            else if (value < 500000.00f)
            {
                commission = 155.00f + 0.0011f * value;
            }
            else
            {
                commission = 255.00f + 0.0009f * value;
            }
            if (commission < 39.00f)
            {
                commission = 39.00f;
            }
            printf("Commission: $%.2f\n", commission);
        }
    }
    system("pause");
    return 0;
}